﻿using SQLite;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GymTimer.Models
{
    public class Schedule
    {
        [PrimaryKey,AutoIncrement]
        public int ID { get; set; }

        [Required]
        public string Name { get; set; } = "";

        //锻炼前准备时间
        public int RepareTime { get; set; } = 10;

        [Ignore]
        public List<Exercise> Exercises { get; set; } = [];


        public override string ToString() => $"{Name}";



        public int TotalTime()
        {
            return RepareTime+Exercises.Sum(s=>s.TotalTime());
        }






    }
}
